<template>
  <div class="index">
    <header>
      <div class="logo">
        <img src="../assets/imgs/index/logo.png" alt="" />
      </div>
      <div class="login-info">
        <div class="user">
          <span class="user-name">
            {{ userName }}
          </span>
          <el-divider direction="vertical"></el-divider>
          <span @click="logout">退出系统</span>
        </div>
      </div>
    </header>
    <div class="warp">
      <div class="nav">
        <el-menu
          :default-active="activeName"
          router
          class="el-menu-vertical-demo"
        >
          <el-menu-item index="/Control">控制台</el-menu-item>
          <el-menu-item index="/CustomerManagement">客户管理</el-menu-item>
          <el-menu-item index="/CRMIntelligence">智能CRM</el-menu-item>
          <el-menu-item index="/AccountManager">账号管理</el-menu-item>
        </el-menu>
      </div>
      <div class="content">
        <router-view></router-view>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent } from "vue";
export default defineComponent({
  name: "Home",
  data() {
    return {
      activeName: "/Control",
      userName: "",
    };
  },
  mounted() {
    (this as any).userName = localStorage.getItem("UserName");
  },
});
</script>
<style lang="less" scoped>
.index {
  header {
    height: 60px;
    background: #b53434;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: url("../assets/imgs/index/top@2x.png");
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    box-sizing: border-box;
    .logo {
      img {
        width: 216px;
        height: 26px;
        vertical-align: middle;
      }
    }
    .login-info {
      display: flex;
      align-items: center;
      .ld {
        img {
          width: 12px;
          height: 16px;
        }
      }
      i {
        margin-right: 32px;
        color: #ffffff;
      }
      .user {
        font-size: 14px;
        color: #fff;
        img {
          width: 24px;
          height: 24px;
          vertical-align: middle;
          margin-right: 8px;
        }
        span {
          cursor: pointer;
        }
      }
    }
  }
  .warp {
    min-height: calc(100vh - 60px);
    display: flex;
    .nav {
      width: 220px;
      min-height: calc(100vh - 60px);
      .el-menu-vertical-demo {
        min-height: calc(100vh - 60px);
      }
    }
    .content {
      flex: 1;
    }
  }
}
@media screen and (max-width: 1440px) {
  .index {
    header,
    .bread,
    .container {
      min-width: 1250px;
      width: 100%;
    }
  }
}
</style>
